
-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 11/06/2011 11:40:32
-- Generated from EDMX file: C:\Documents and Settings\Camille\mes documents\visual studio 2010\Projects\LearningCompany_DAO\LearningCompany_DAO\LearningCompany.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [LearningCompany];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO

-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[FK_SessionFormationStagiaire_SessionFormation]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[SessionFormationStagiaire] DROP CONSTRAINT [FK_SessionFormationStagiaire_SessionFormation];
GO
IF OBJECT_ID(N'[dbo].[FK_SessionFormationStagiaire_Stagiaire]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[SessionFormationStagiaire] DROP CONSTRAINT [FK_SessionFormationStagiaire_Stagiaire];
GO
IF OBJECT_ID(N'[dbo].[FK_SecteurActiviteClient]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Client] DROP CONSTRAINT [FK_SecteurActiviteClient];
GO
IF OBJECT_ID(N'[dbo].[FK_ClientDemandeClient]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[DemandeClient] DROP CONSTRAINT [FK_ClientDemandeClient];
GO
IF OBJECT_ID(N'[dbo].[FK_ThemeFormation]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Formation] DROP CONSTRAINT [FK_ThemeFormation];
GO
IF OBJECT_ID(N'[dbo].[FK_FormateurSessionFormation]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[SessionFormation] DROP CONSTRAINT [FK_FormateurSessionFormation];
GO
IF OBJECT_ID(N'[dbo].[FK_CiviliteFormateur]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Formateur] DROP CONSTRAINT [FK_CiviliteFormateur];
GO
IF OBJECT_ID(N'[dbo].[FK_CiviliteStagiaire]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Stagiaire] DROP CONSTRAINT [FK_CiviliteStagiaire];
GO
IF OBJECT_ID(N'[dbo].[FK_CiviliteCommercial]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Commercial] DROP CONSTRAINT [FK_CiviliteCommercial];
GO
IF OBJECT_ID(N'[dbo].[FK_CommercialClient]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Client] DROP CONSTRAINT [FK_CommercialClient];
GO
IF OBJECT_ID(N'[dbo].[FK_CommercialSessionFormation]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[SessionFormation] DROP CONSTRAINT [FK_CommercialSessionFormation];
GO
IF OBJECT_ID(N'[dbo].[FK_ClientStagiaire]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Stagiaire] DROP CONSTRAINT [FK_ClientStagiaire];
GO
IF OBJECT_ID(N'[dbo].[FK_FormationSessionFormation]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[SessionFormation] DROP CONSTRAINT [FK_FormationSessionFormation];
GO
IF OBJECT_ID(N'[dbo].[FK_FormationDemandeClient]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[DemandeClient] DROP CONSTRAINT [FK_FormationDemandeClient];
GO
IF OBJECT_ID(N'[dbo].[FK_FormateurFormation_Formateur]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[FormateurFormation] DROP CONSTRAINT [FK_FormateurFormation_Formateur];
GO
IF OBJECT_ID(N'[dbo].[FK_FormateurFormation_Formation]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[FormateurFormation] DROP CONSTRAINT [FK_FormateurFormation_Formation];
GO
IF OBJECT_ID(N'[dbo].[FK_FormationPresentielle_inherits_Formation]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Formation_FormationPresentielle] DROP CONSTRAINT [FK_FormationPresentielle_inherits_Formation];
GO
IF OBJECT_ID(N'[dbo].[FK_FormationElearning_inherits_Formation]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Formation_FormationElearning] DROP CONSTRAINT [FK_FormationElearning_inherits_Formation];
GO

-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[Civilite]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Civilite];
GO
IF OBJECT_ID(N'[dbo].[Stagiaire]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Stagiaire];
GO
IF OBJECT_ID(N'[dbo].[SecteurActivite]', 'U') IS NOT NULL
    DROP TABLE [dbo].[SecteurActivite];
GO
IF OBJECT_ID(N'[dbo].[Theme]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Theme];
GO
IF OBJECT_ID(N'[dbo].[Commercial]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Commercial];
GO
IF OBJECT_ID(N'[dbo].[Client]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Client];
GO
IF OBJECT_ID(N'[dbo].[DemandeClient]', 'U') IS NOT NULL
    DROP TABLE [dbo].[DemandeClient];
GO
IF OBJECT_ID(N'[dbo].[Formation]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Formation];
GO
IF OBJECT_ID(N'[dbo].[SessionFormation]', 'U') IS NOT NULL
    DROP TABLE [dbo].[SessionFormation];
GO
IF OBJECT_ID(N'[dbo].[Formateur]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Formateur];
GO
IF OBJECT_ID(N'[dbo].[Formation_FormationPresentielle]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Formation_FormationPresentielle];
GO
IF OBJECT_ID(N'[dbo].[Formation_FormationElearning]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Formation_FormationElearning];
GO
IF OBJECT_ID(N'[dbo].[SessionFormationStagiaire]', 'U') IS NOT NULL
    DROP TABLE [dbo].[SessionFormationStagiaire];
GO
IF OBJECT_ID(N'[dbo].[FormateurFormation]', 'U') IS NOT NULL
    DROP TABLE [dbo].[FormateurFormation];
GO

-- --------------------------------------------------
-- Creating all tables
-- --------------------------------------------------

-- Creating table 'Civilite'
CREATE TABLE [dbo].[Civilite] (
    [Identifiant] int IDENTITY(1,1) NOT NULL,
    [LibelleCourt] nvarchar(50)  NOT NULL,
    [LibelleLong] nvarchar(50)  NOT NULL
);
GO

-- Creating table 'Stagiaire'
CREATE TABLE [dbo].[Stagiaire] (
    [Identifiant] int IDENTITY(1,1) NOT NULL,
    [Nom] nvarchar(50)  NOT NULL,
    [Prenom] nvarchar(50)  NOT NULL,
    [Email] nvarchar(50)  NOT NULL,
    [Civilite_Identifiant] int  NOT NULL,
    [Client_Identifiant] int  NOT NULL
);
GO

-- Creating table 'SecteurActivite'
CREATE TABLE [dbo].[SecteurActivite] (
    [Identifiant] int IDENTITY(1,1) NOT NULL,
    [Libelle] nvarchar(50)  NOT NULL
);
GO

-- Creating table 'Theme'
CREATE TABLE [dbo].[Theme] (
    [Identifiant] int IDENTITY(1,1) NOT NULL,
    [Libelle] nvarchar(50)  NOT NULL
);
GO

-- Creating table 'Commercial'
CREATE TABLE [dbo].[Commercial] (
    [Identifiant] int IDENTITY(1,1) NOT NULL,
    [NomUtilisateur] nvarchar(50)  NOT NULL,
    [MotDePasse] nvarchar(50)  NOT NULL,
    [Nom] nvarchar(50)  NOT NULL,
    [Prenom] nvarchar(50)  NOT NULL,
    [Email] nvarchar(50)  NOT NULL,
    [Civilite_Identifiant] int  NOT NULL
);
GO

-- Creating table 'Client'
CREATE TABLE [dbo].[Client] (
    [Identifiant] int IDENTITY(1,1) NOT NULL,
    [Reference] nvarchar(50)  NOT NULL,
    [RaisonSociale] nvarchar(50)  NOT NULL,
    [Adresse] nvarchar(50)  NOT NULL,
    [CodePostal] nvarchar(50)  NOT NULL,
    [Ville] nvarchar(50)  NOT NULL,
    [Telephone] nvarchar(50)  NOT NULL,
    [Email] nvarchar(50)  NOT NULL,
    [UrlSiteWeb] nvarchar(50)  NOT NULL,
    [MotDePasse] nvarchar(50)  NOT NULL,
    [SecteurActivite_Identifiant] int  NOT NULL,
    [Commercial_Identifiant] int  NOT NULL
);
GO

-- Creating table 'DemandeClient'
CREATE TABLE [dbo].[DemandeClient] (
    [Identifiant] int IDENTITY(1,1) NOT NULL,
    [DateDemande] datetime  NOT NULL,
    [DateTraitement] datetime  NULL,
    [Client_Identifiant] int  NOT NULL,
    [Formation_Identifiant] int  NOT NULL
);
GO

-- Creating table 'Formation'
CREATE TABLE [dbo].[Formation] (
    [Identifiant] int IDENTITY(1,1) NOT NULL,
    [Reference] nvarchar(50)  NOT NULL,
    [Libelle] nvarchar(50)  NOT NULL,
    [NombreJours] smallint  NOT NULL,
    [Prix] smallint  NOT NULL,
    [Description] nvarchar(250)  NOT NULL,
    [Theme_Identifiant] int  NOT NULL
);
GO

-- Creating table 'SessionFormation'
CREATE TABLE [dbo].[SessionFormation] (
    [Identifiant] int IDENTITY(1,1) NOT NULL,
    [DateDebut] datetime  NOT NULL,
    [DateFin] datetime  NOT NULL,
    [Inter] bit  NOT NULL,
    [Formateur_Identifiant] int  NOT NULL,
    [Commercial_Identifiant] int  NOT NULL,
    [Formation_Identifiant] int  NOT NULL
);
GO

-- Creating table 'Formateur'
CREATE TABLE [dbo].[Formateur] (
    [Identifiant] int IDENTITY(1,1) NOT NULL,
    [Nom] nvarchar(50)  NOT NULL,
    [Prenom] nvarchar(50)  NOT NULL,
    [NomFichierPhoto] nvarchar(50)  NOT NULL,
    [Email] nvarchar(50)  NOT NULL,
    [Telephone] nvarchar(50)  NOT NULL,
    [IntervenantExterieur] bit  NOT NULL,
    [Infos] nvarchar(250)  NOT NULL,
    [Civilite_Identifiant] int  NOT NULL
);
GO

-- Creating table 'Formation_FormationPresentielle'
CREATE TABLE [dbo].[Formation_FormationPresentielle] (
    [Lieu] nvarchar(50)  NOT NULL,
    [Identifiant] int  NOT NULL
);
GO

-- Creating table 'Formation_FormationElearning'
CREATE TABLE [dbo].[Formation_FormationElearning] (
    [Url] nvarchar(50)  NOT NULL,
    [Identifiant] int  NOT NULL
);
GO

-- Creating table 'SessionFormationStagiaire'
CREATE TABLE [dbo].[SessionFormationStagiaire] (
    [SessionsFormation_Identifiant] int  NOT NULL,
    [Stagiaires_Identifiant] int  NOT NULL
);
GO

-- Creating table 'FormateurFormation'
CREATE TABLE [dbo].[FormateurFormation] (
    [Formateurs_Identifiant] int  NOT NULL,
    [Formations_Identifiant] int  NOT NULL
);
GO

-- --------------------------------------------------
-- Creating all PRIMARY KEY constraints
-- --------------------------------------------------

-- Creating primary key on [Identifiant] in table 'Civilite'
ALTER TABLE [dbo].[Civilite]
ADD CONSTRAINT [PK_Civilite]
    PRIMARY KEY CLUSTERED ([Identifiant] ASC);
GO

-- Creating primary key on [Identifiant] in table 'Stagiaire'
ALTER TABLE [dbo].[Stagiaire]
ADD CONSTRAINT [PK_Stagiaire]
    PRIMARY KEY CLUSTERED ([Identifiant] ASC);
GO

-- Creating primary key on [Identifiant] in table 'SecteurActivite'
ALTER TABLE [dbo].[SecteurActivite]
ADD CONSTRAINT [PK_SecteurActivite]
    PRIMARY KEY CLUSTERED ([Identifiant] ASC);
GO

-- Creating primary key on [Identifiant] in table 'Theme'
ALTER TABLE [dbo].[Theme]
ADD CONSTRAINT [PK_Theme]
    PRIMARY KEY CLUSTERED ([Identifiant] ASC);
GO

-- Creating primary key on [Identifiant] in table 'Commercial'
ALTER TABLE [dbo].[Commercial]
ADD CONSTRAINT [PK_Commercial]
    PRIMARY KEY CLUSTERED ([Identifiant] ASC);
GO

-- Creating primary key on [Identifiant] in table 'Client'
ALTER TABLE [dbo].[Client]
ADD CONSTRAINT [PK_Client]
    PRIMARY KEY CLUSTERED ([Identifiant] ASC);
GO

-- Creating primary key on [Identifiant] in table 'DemandeClient'
ALTER TABLE [dbo].[DemandeClient]
ADD CONSTRAINT [PK_DemandeClient]
    PRIMARY KEY CLUSTERED ([Identifiant] ASC);
GO

-- Creating primary key on [Identifiant] in table 'Formation'
ALTER TABLE [dbo].[Formation]
ADD CONSTRAINT [PK_Formation]
    PRIMARY KEY CLUSTERED ([Identifiant] ASC);
GO

-- Creating primary key on [Identifiant] in table 'SessionFormation'
ALTER TABLE [dbo].[SessionFormation]
ADD CONSTRAINT [PK_SessionFormation]
    PRIMARY KEY CLUSTERED ([Identifiant] ASC);
GO

-- Creating primary key on [Identifiant] in table 'Formateur'
ALTER TABLE [dbo].[Formateur]
ADD CONSTRAINT [PK_Formateur]
    PRIMARY KEY CLUSTERED ([Identifiant] ASC);
GO

-- Creating primary key on [Identifiant] in table 'Formation_FormationPresentielle'
ALTER TABLE [dbo].[Formation_FormationPresentielle]
ADD CONSTRAINT [PK_Formation_FormationPresentielle]
    PRIMARY KEY CLUSTERED ([Identifiant] ASC);
GO

-- Creating primary key on [Identifiant] in table 'Formation_FormationElearning'
ALTER TABLE [dbo].[Formation_FormationElearning]
ADD CONSTRAINT [PK_Formation_FormationElearning]
    PRIMARY KEY CLUSTERED ([Identifiant] ASC);
GO

-- Creating primary key on [SessionsFormation_Identifiant], [Stagiaires_Identifiant] in table 'SessionFormationStagiaire'
ALTER TABLE [dbo].[SessionFormationStagiaire]
ADD CONSTRAINT [PK_SessionFormationStagiaire]
    PRIMARY KEY NONCLUSTERED ([SessionsFormation_Identifiant], [Stagiaires_Identifiant] ASC);
GO

-- Creating primary key on [Formateurs_Identifiant], [Formations_Identifiant] in table 'FormateurFormation'
ALTER TABLE [dbo].[FormateurFormation]
ADD CONSTRAINT [PK_FormateurFormation]
    PRIMARY KEY NONCLUSTERED ([Formateurs_Identifiant], [Formations_Identifiant] ASC);
GO

-- --------------------------------------------------
-- Creating all FOREIGN KEY constraints
-- --------------------------------------------------

-- Creating foreign key on [SessionsFormation_Identifiant] in table 'SessionFormationStagiaire'
ALTER TABLE [dbo].[SessionFormationStagiaire]
ADD CONSTRAINT [FK_SessionFormationStagiaire_SessionFormation]
    FOREIGN KEY ([SessionsFormation_Identifiant])
    REFERENCES [dbo].[SessionFormation]
        ([Identifiant])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating foreign key on [Stagiaires_Identifiant] in table 'SessionFormationStagiaire'
ALTER TABLE [dbo].[SessionFormationStagiaire]
ADD CONSTRAINT [FK_SessionFormationStagiaire_Stagiaire]
    FOREIGN KEY ([Stagiaires_Identifiant])
    REFERENCES [dbo].[Stagiaire]
        ([Identifiant])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_SessionFormationStagiaire_Stagiaire'
CREATE INDEX [IX_FK_SessionFormationStagiaire_Stagiaire]
ON [dbo].[SessionFormationStagiaire]
    ([Stagiaires_Identifiant]);
GO

-- Creating foreign key on [SecteurActivite_Identifiant] in table 'Client'
ALTER TABLE [dbo].[Client]
ADD CONSTRAINT [FK_SecteurActiviteClient]
    FOREIGN KEY ([SecteurActivite_Identifiant])
    REFERENCES [dbo].[SecteurActivite]
        ([Identifiant])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_SecteurActiviteClient'
CREATE INDEX [IX_FK_SecteurActiviteClient]
ON [dbo].[Client]
    ([SecteurActivite_Identifiant]);
GO

-- Creating foreign key on [Client_Identifiant] in table 'DemandeClient'
ALTER TABLE [dbo].[DemandeClient]
ADD CONSTRAINT [FK_ClientDemandeClient]
    FOREIGN KEY ([Client_Identifiant])
    REFERENCES [dbo].[Client]
        ([Identifiant])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ClientDemandeClient'
CREATE INDEX [IX_FK_ClientDemandeClient]
ON [dbo].[DemandeClient]
    ([Client_Identifiant]);
GO

-- Creating foreign key on [Theme_Identifiant] in table 'Formation'
ALTER TABLE [dbo].[Formation]
ADD CONSTRAINT [FK_ThemeFormation]
    FOREIGN KEY ([Theme_Identifiant])
    REFERENCES [dbo].[Theme]
        ([Identifiant])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ThemeFormation'
CREATE INDEX [IX_FK_ThemeFormation]
ON [dbo].[Formation]
    ([Theme_Identifiant]);
GO

-- Creating foreign key on [Formateur_Identifiant] in table 'SessionFormation'
ALTER TABLE [dbo].[SessionFormation]
ADD CONSTRAINT [FK_FormateurSessionFormation]
    FOREIGN KEY ([Formateur_Identifiant])
    REFERENCES [dbo].[Formateur]
        ([Identifiant])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_FormateurSessionFormation'
CREATE INDEX [IX_FK_FormateurSessionFormation]
ON [dbo].[SessionFormation]
    ([Formateur_Identifiant]);
GO

-- Creating foreign key on [Civilite_Identifiant] in table 'Formateur'
ALTER TABLE [dbo].[Formateur]
ADD CONSTRAINT [FK_CiviliteFormateur]
    FOREIGN KEY ([Civilite_Identifiant])
    REFERENCES [dbo].[Civilite]
        ([Identifiant])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_CiviliteFormateur'
CREATE INDEX [IX_FK_CiviliteFormateur]
ON [dbo].[Formateur]
    ([Civilite_Identifiant]);
GO

-- Creating foreign key on [Civilite_Identifiant] in table 'Stagiaire'
ALTER TABLE [dbo].[Stagiaire]
ADD CONSTRAINT [FK_CiviliteStagiaire]
    FOREIGN KEY ([Civilite_Identifiant])
    REFERENCES [dbo].[Civilite]
        ([Identifiant])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_CiviliteStagiaire'
CREATE INDEX [IX_FK_CiviliteStagiaire]
ON [dbo].[Stagiaire]
    ([Civilite_Identifiant]);
GO

-- Creating foreign key on [Civilite_Identifiant] in table 'Commercial'
ALTER TABLE [dbo].[Commercial]
ADD CONSTRAINT [FK_CiviliteCommercial]
    FOREIGN KEY ([Civilite_Identifiant])
    REFERENCES [dbo].[Civilite]
        ([Identifiant])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_CiviliteCommercial'
CREATE INDEX [IX_FK_CiviliteCommercial]
ON [dbo].[Commercial]
    ([Civilite_Identifiant]);
GO

-- Creating foreign key on [Commercial_Identifiant] in table 'Client'
ALTER TABLE [dbo].[Client]
ADD CONSTRAINT [FK_CommercialClient]
    FOREIGN KEY ([Commercial_Identifiant])
    REFERENCES [dbo].[Commercial]
        ([Identifiant])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_CommercialClient'
CREATE INDEX [IX_FK_CommercialClient]
ON [dbo].[Client]
    ([Commercial_Identifiant]);
GO

-- Creating foreign key on [Commercial_Identifiant] in table 'SessionFormation'
ALTER TABLE [dbo].[SessionFormation]
ADD CONSTRAINT [FK_CommercialSessionFormation]
    FOREIGN KEY ([Commercial_Identifiant])
    REFERENCES [dbo].[Commercial]
        ([Identifiant])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_CommercialSessionFormation'
CREATE INDEX [IX_FK_CommercialSessionFormation]
ON [dbo].[SessionFormation]
    ([Commercial_Identifiant]);
GO

-- Creating foreign key on [Client_Identifiant] in table 'Stagiaire'
ALTER TABLE [dbo].[Stagiaire]
ADD CONSTRAINT [FK_ClientStagiaire]
    FOREIGN KEY ([Client_Identifiant])
    REFERENCES [dbo].[Client]
        ([Identifiant])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ClientStagiaire'
CREATE INDEX [IX_FK_ClientStagiaire]
ON [dbo].[Stagiaire]
    ([Client_Identifiant]);
GO

-- Creating foreign key on [Formation_Identifiant] in table 'SessionFormation'
ALTER TABLE [dbo].[SessionFormation]
ADD CONSTRAINT [FK_FormationSessionFormation]
    FOREIGN KEY ([Formation_Identifiant])
    REFERENCES [dbo].[Formation]
        ([Identifiant])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_FormationSessionFormation'
CREATE INDEX [IX_FK_FormationSessionFormation]
ON [dbo].[SessionFormation]
    ([Formation_Identifiant]);
GO

-- Creating foreign key on [Formation_Identifiant] in table 'DemandeClient'
ALTER TABLE [dbo].[DemandeClient]
ADD CONSTRAINT [FK_FormationDemandeClient]
    FOREIGN KEY ([Formation_Identifiant])
    REFERENCES [dbo].[Formation]
        ([Identifiant])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_FormationDemandeClient'
CREATE INDEX [IX_FK_FormationDemandeClient]
ON [dbo].[DemandeClient]
    ([Formation_Identifiant]);
GO

-- Creating foreign key on [Formateurs_Identifiant] in table 'FormateurFormation'
ALTER TABLE [dbo].[FormateurFormation]
ADD CONSTRAINT [FK_FormateurFormation_Formateur]
    FOREIGN KEY ([Formateurs_Identifiant])
    REFERENCES [dbo].[Formateur]
        ([Identifiant])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating foreign key on [Formations_Identifiant] in table 'FormateurFormation'
ALTER TABLE [dbo].[FormateurFormation]
ADD CONSTRAINT [FK_FormateurFormation_Formation]
    FOREIGN KEY ([Formations_Identifiant])
    REFERENCES [dbo].[Formation]
        ([Identifiant])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_FormateurFormation_Formation'
CREATE INDEX [IX_FK_FormateurFormation_Formation]
ON [dbo].[FormateurFormation]
    ([Formations_Identifiant]);
GO

-- Creating foreign key on [Identifiant] in table 'Formation_FormationPresentielle'
ALTER TABLE [dbo].[Formation_FormationPresentielle]
ADD CONSTRAINT [FK_FormationPresentielle_inherits_Formation]
    FOREIGN KEY ([Identifiant])
    REFERENCES [dbo].[Formation]
        ([Identifiant])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating foreign key on [Identifiant] in table 'Formation_FormationElearning'
ALTER TABLE [dbo].[Formation_FormationElearning]
ADD CONSTRAINT [FK_FormationElearning_inherits_Formation]
    FOREIGN KEY ([Identifiant])
    REFERENCES [dbo].[Formation]
        ([Identifiant])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------